package order

import (
	"mallgo/core"
	"mallgo/internal/resources/order/resource"

	"go.uber.org/fx"
)

// InitRouter 初始化订单相关路由
func InitRouter(orderResource *resource.OrderResource, s *core.AppServer) {
	controller := NewOrderController(orderResource)

	// 订单相关路由组
	orderGroup := s.Engine.Group("/order")
	{
		orderGroup.POST("/create", controller.CreateOrder) // 创建订单
	}
}

var Module = fx.Options(
	fx.Provide(
		resource.NewOrderResource,
		NewOrderController,
	),
	fx.Invoke(
		InitRouter,
	),
)
